﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using QL_KhachSan.App_Code.DAL;

namespace QL_KhachSan
{
    public partial class Form_Dangnhap : Form
    {
        private db_Connection _user;
        public Form_Dangnhap()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e) { }

        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            _user = new db_Connection();
            DataTable dt = new DataTable();
            SqlParameter[] p = new SqlParameter[2];
            p[0] = new SqlParameter("username", txt_username.Text);
            p[1] = new SqlParameter("password", txt_matkhau.Text);
            dt = _user.proc_select_para("Select_Nguoidung", p);
            if (dt.Rows.Count == 1)
            {
                Form_Main m = new Form_Main();
                m.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Bạn hãy điền lại thông tin đăng nhập.");
            }
        }
    }
}
